Move rot13() to QString.
authorrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 27 Jan 2015 03:40:52 +0000 (03:40 +0000)
committerrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 27 Jan 2015 03:40:52 +0000 (03:40 +0000)
gpsbabel/reference/gc/GCGCA8.gpx
gpsbabel/reference/gc/GCGCA8~html.txt
gpsbabel/reference/gc/GCGCA8~text-encoded.txt [new file with mode: 0644]
gpsbabel/reference/gc/GCGCA8~text.txt
gpsbabel/reference/gc/maggeo.gs
gpsbabel/testo.d/text.test
gpsbabel/util.cc

index c815350f940701349b68f2ec95c09628abbac390..146adb274a2c2f8a280c4f99a7c79cdfc01a6c49 100644 (file)
@@ -45,6 +45,7 @@ Now that it's intuitively obvious to even the most casual observer where the cac
 &lt;br&gt;\r
 &lt;img SRC="http://www.mtgc.org/mtgc_member-banner.gif" WIDTH="500" HEIGHT="40" ALT="Member of Middle Tennessee GeoCachers Club [www.mtgc.org]" BORDER="0"&gt;&lt;/a&gt;&lt;/p&gt;</groundspeak:long_description>\r
       <groundspeak:encoded_hints>\r
+      There Is No Hint\r
       </groundspeak:encoded_hints>\r
       <groundspeak:logs>\r
         <groundspeak:log id="8859126">\r
index 50b79a2c0aa99494e0d28454830640abcd3dd206..239c450d070f37d6b13ce8740e041854bf24bb95 100644 (file)
@@ -35,5 +35,6 @@ Unknown Cache / Unknown</p></td></tr>
 Now that it's intuitively obvious to even the most casual observer where the cache is, turn on your geo-mojo and go find it.
 <br>
 <img SRC="http://www.mtgc.org/mtgc_member-banner.gif" WIDTH="500" HEIGHT="40" ALT="Member of Middle Tennessee GeoCachers Club [www.mtgc.org]" BORDER="0"></a></p></p>
+<p class="gpsbabelhint"><strong>Hint:</strong> There Is No Hint</p>
 </td></tr></table>
 </body></html>
diff --git a/gpsbabel/reference/gc/GCGCA8~text-encoded.txt b/gpsbabel/reference/gc/GCGCA8~text-encoded.txt
new file mode 100644 (file)
index 0000000..dd439f5
--- /dev/null
@@ -0,0 +1,12 @@
+-----------------------------------------------------------------------------
+GCGCA8                             N35 55.300 W86 51.700 (16S 512480 3975269)
+Oozy rat in a sanitary zoo by robertlipe - Unknown Cache / Unknown - (3 / 2)
+
+The cache is not at the coordinates above.   These coords will get you to the correct park and within 1/2 mile of the cache.  The cache is within 35 feet of the trail.   It is not handicapped accessible.   It is a nice walk in the woods that is practical for all ages.  There is no space in the container for trading items.   You should bring a writing stick and bug spray is recommended.
+
+So if the cache isn't at the above coordinates, where is it?    Too bad I hid a boot Too hot to hoot Never odd or even Do geese see God? "Do nine men interpret?" "Nine men," I nod Rats live on no evil star Go hang a salami, I'm a lasagna hog  Now that it's intuitively obvious to even the most casual observer where the cache is, turn on your geo-mojo and go find it. 
+ [IMG]
+
+Hint: Gurer Vf Ab Uvag
+
+-----------------------------------------------------------------------------
index 2ff60e87c68485a201f67df558b0022a1ac7a00f..c742a7ba78f849636c3a0d6f50ff666c52c1e8d8 100644 (file)
@@ -7,4 +7,6 @@ The cache is not at the coordinates above.   These coords will get you to the co
 So if the cache isn't at the above coordinates, where is it?    Too bad I hid a boot Too hot to hoot Never odd or even Do geese see God? "Do nine men interpret?" "Nine men," I nod Rats live on no evil star Go hang a salami, I'm a lasagna hog  Now that it's intuitively obvious to even the most casual observer where the cache is, turn on your geo-mojo and go find it. 
  [IMG]
 
+Hint: There Is No Hint
+
 -----------------------------------------------------------------------------
index 6bf5b8f574ee62eb665ba01af1fcb203d3d99121..dd89fbf7c15764d3ff84e10537aa29ed84fdbfed 100644 (file)
@@ -1,3 +1,3 @@
 $PMGNGEO,4608.000,N,7300.000,W,0000,F,GC7FA4,Points godsiques,Sverdrup2,,Locationless (Reverse) Cache,1508102,1207105,1.0,1.0*7A\r
-$PMGNGEO,3555.300,N,8651.700,W,0000,F,GCGCA8,Oozy rat in a sanita,robertlipe,,Mystery Cache,2906103,0307105,3.0,2.0*4A\r
+$PMGNGEO,3555.300,N,8651.700,W,0000,F,GCGCA8,Oozy rat in a sanita,robertlipe,There Is No Hint,Mystery Cache,2906103,0307105,3.0,2.0*04\r
 $PMGNCMD,END*3D\r
index 0edef26c464e56f38f122f7b0bf39c98b167f139..71ce40ebb9206bd0630e48c752d6650937bbcfb2 100644 (file)
@@ -1,5 +1,9 @@
 #  Test HTML and Text output of a geocache.
 
-gpsbabel -i gpx -f ${REFERENCE}/gc/GCGCA8.gpx -o html -F ${TMPDIR}/gc.html -o text -F ${TMPDIR}/gc.txt
+gpsbabel -i gpx -f ${REFERENCE}/gc/GCGCA8.gpx \
+  -o html -F ${TMPDIR}/gc.html \
+  -o text -F ${TMPDIR}/gc.txt \
+  -o text,encrypt -F ${TMPDIR}/gc-encoded.txt
 compare ${REFERENCE}/gc/GCGCA8~text.txt ${TMPDIR}/gc.txt
+compare ${REFERENCE}/gc/GCGCA8~text-encoded.txt ${TMPDIR}/gc-encoded.txt
 compare ${REFERENCE}/gc/GCGCA8~html.txt ${TMPDIR}/gc.html
index abb67520c4bb52e4710ccc3c8f6b52a9aac2e969..214fd1f5956b9eaa20d46b009ff8502a1217b746 100644 (file)
@@ -1168,25 +1168,20 @@ strlower(char* src)
 QString
 rot13(const QString& s)
 {
-  char* result = xstrdup(s);
-  char* cur = result;
-  int flip = 1;
-  while (cur && *cur) {
-    if (flip) {
-      if (*cur == '[') {
-        flip = 0;
-      } else if (*cur >= 'A' && *cur <= 'Z') {
-        *cur = 'A' + ((*cur-'A')+13)%26;
-      } else if (*cur >= 'a' && *cur <= 'z') {
-        *cur = 'a' + ((*cur-'a')+13)%26;
-      }
-    } else if (*cur == ']') {
-      flip = 1;
+  static const QChar A('A');
+  static const QChar M('M');
+  static const QChar N('N');
+  static const QChar Z('Z');
+  QString r = s;
+  int i = r.length();
+  while(i--) {
+    QChar letter = r[i].toUpper();
+    if (letter >= A && letter <= M) {
+      r[i] = QChar(r[i].toLatin1() + 13);
+    } else if (letter >= N && letter <= Z) {
+      r[i] = QChar(r[i].toLatin1() - 13);
     }
-    cur++;
   }
-  QString r(result);
-  xfree(result);
   return r;
 }